package com.wenson.behavior.interpreter;

/**
 * @ClassName: Delay
 * @Author: luowangcheng
 * @Date: 2024/6/16 18:07
 * @Description:
 */
public class Delay implements Expression {
    private int seconds;

    public Delay(int seconds) {
        this.seconds = seconds;
    }

    public int getSeconds() {
        return seconds;
    }

    @Override
    public void interpret() {
        System.out.println("系统延迟："+seconds+"秒");
        try {
            Thread.sleep(seconds * 1000);

        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
